<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%@ page import="com.scalar.chiptrack.sales.forms.quote.ApproverQuotationForm,com.scalar.chiptrack.utils.ConfigManager"%>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<%
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<style type="text/css">
a { text-decoration : none}
</style>
<script language="javaScript">

    function getPrevQuotationsArray()
    {
        var parent= window.opener;
        return parent.qa;
    }
    function getPrevQuotationsPriceArray()
    {
        var parent= window.opener;
        return parent.qaPrice;
    }
    function getPrevCommitmentsArray()
    {
        var parent= window.opener;
        return parent.qaCommitments;
    }

    <%--function loadPrevQuotations()
    {
       newWindow = window.open('<%=chipTracContext%>/jsp/sales/quote/prev_quotations_view.jsp','quotationPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=800,height=400,left=100,top=50,resizable=yes');
  	   newWindow.focus();
    }
    function loadQuotationsPrices()
    {
       newWindow = window.open('<%=chipTracContext%>/jsp/sales/quote/prev_quotaton_latest_prices.jsp','quotationPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=400,left=100,top=50,resizable=yes');
  	   newWindow.focus();
    }
    function loadPrevCommitments()
    {
       newWindow = window.open('<%=chipTracContext%>/jsp/sales/quote/prev_commitments_details.jsp','quotationPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=400,left=100,top=50,resizable=yes');
  	   newWindow.focus();
    }--%>
    function loadQuotationsPrices()
    {
       var parent=window.opener; 
       newWindow = window.open('<%=chipTracContext%>/previousQuotationPriceDetailsSearch.do?subAction=chiptracPreviousQuoteLatestPriceSearch&customerId='+ parent.document.QuotationForm.customerId.value ,'commitmentsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=800,height=500,left=100,top=50,resizable=no');
  	   newWindow.focus();
    }
    function loadPrevQuotations()
    {
       var parent=window.opener;
       newWindow = window.open('<%=chipTracContext%>/previousQuotationsDetailsSearch.do?subAction=chiptracPreviousQuotationsDetailsSearch&customerId='+ parent.document.QuotationForm.customerId.value ,'commitmentsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=800,height=500,left=100,top=50,resizable=no');
  	   newWindow.focus();
    }
    function loadPrevCommitments()
    {
       var parent=window.opener;
       newWindow = window.open('<%=chipTracContext%>/previousCommitmentsDetails.do?subAction=chiptracPreviouscommitmnetsDetailsSearch&customerId='+ parent.document.QuotationForm.customerId.value ,'commitmentsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=800,height=550,left=100,top=50,resizable=no');
  	   newWindow.focus();
    }
    function closeWindow(form)
    {
        window.close();
    }
    function addTextArea()
    {
        var parent=window.opener;
        var customerId=parent.document.QuotationForm.customerId.value;
        var customerName =parent.document.QuotationForm.customerName.value;
        var quotationNo=parent.document.QuotationForm.quotationNo.value;
        var endCustomerId=parent.document.QuotationForm.endCustomerId.value;
        var endCustomer=parent.document.QuotationForm.endCustomer.value;
        var odm=parent.document.QuotationForm.odm.value;
        var newEndUserName=parent.document.QuotationForm.newEndUserName.value;
        var newEndCustomerName=parent.document.QuotationForm.newEndCustomerName.value;
        var odmId=parent.document.QuotationForm.odmId.value;
        var quotationType=parent.document.QuotationForm.quotationType.value;
        var currentPrice=parent.document.QuotationForm.currentPrice.value;
        var currentPriceUnits =parent.document.QuotationForm.currentPriceUnits.value;
        var currentPriceUnitsType=parent.document.QuotationForm.currentPriceUnitsType.value;
        var currentPriceOthers=parent.document.QuotationForm.currentPriceOthers.value;
        var targetPrice=parent.document.QuotationForm.targetPrice.value;
        var targetPriceUnitsType=parent.document.QuotationForm.targetPriceUnitsType.value;
        var targetPriceUnits=parent.document.QuotationForm.targetPriceUnits.value;
        var targetPriceOthers=parent.document.QuotationForm.targetPriceOthers.value;
        var historyPricesInfo=parent.document.QuotationForm.historyPricesInfo.value;
        var contractPriceFlag=parent.document.QuotationForm.contractPriceFlag.value;
        /*var contractPriceFilePath=parent.document.QuotationForm.contractPriceFilePath.value;*/
        var contractPriceChangedReason=parent.document.QuotationForm.contractPriceChangedReason.value;
        var previousCommitments=parent.document.QuotationForm.previousCommitments.value;
        var previousCommitmentsPrice=parent.document.QuotationForm.previousCommitmentsPrice.value;
        var commitmentAddtionalInfo=parent.document.QuotationForm.commitmentAddtionalInfo.value;
        var previousQuotation=parent.document.QuotationForm.previousQuotation.value;
        var previousQuotationDetails=parent.document.QuotationForm.previousQuotationDetails.value;
        var priceDiscountReason= '';
        if( parent.document.QuotationForm.priceDiscountReason != null && parent.document.QuotationForm.priceDiscountReason.length > 0 )
        {
            for( var i=0; i< parent.document.QuotationForm.priceDiscountReason.length; i++ )
            {
                priceDiscountReason =  priceDiscountReason + parent.document.QuotationForm.priceDiscountReason[i].value + "  <br>";
            }
        }
        else if( parent.document.QuotationForm.priceDiscountReason != null )
        {
            priceDiscountReason =  parent.document.QuotationForm.priceDiscountReason.value;    
        }
        var priceDiscountComments=parent.document.QuotationForm.priceDiscountComments.value;
        var rebate=parent.document.QuotationForm.rebate.value;
        var rebateValue=parent.document.QuotationForm.rebateValue.value;
        var rebateOpertunity=parent.document.QuotationForm.rebateOpertunity.value;
        var rebateGoal=parent.document.QuotationForm.rebateGoal.value;
        var rebateTarget=parent.document.QuotationForm.rebateTarget.value;
        var rebateTargetValue=parent.document.QuotationForm.rebateTargetValue.value;
        var rebateVerifiedBy=parent.document.QuotationForm.rebateVerifiedBy.value;
        var competatior1=parent.document.QuotationForm.competatior1.value;
        var competatior1Others=parent.document.QuotationForm.competatior1Others.value;
        var competatior1Price=parent.document.QuotationForm.competatior1Price.value;
        var competatior1PriceUnit=parent.document.QuotationForm.competatior1PriceUnit.value;
        var competatior1Comments=parent.document.QuotationForm.competatior1Comments.value;
        var competatior2=parent.document.QuotationForm.competatior2.value;
        var competatior2Others=parent.document.QuotationForm.competatior2Others.value;
        var competatior2Price=parent.document.QuotationForm.competatior2Price.value;
        var competatior2PriceUnit=parent.document.QuotationForm.competatior2PriceUnit.value;
        var competatior2Comments=parent.document.QuotationForm.competatior2Comments.value;
        var distributorMargin=parent.document.QuotationForm.distributorMargin.value;
        var marginDollars=parent.document.QuotationForm.marginDollars.value;
        var totalPrevMargins=parent.document.QuotationForm.totalPrevMargins.value;
        var marginReason=parent.document.QuotationForm.marginReason.value;
        var prevQuotationNo=parent.document.QuotationForm.prevQuotationNo.value;
        var contractPriceFileName=parent.document.QuotationForm.contractPriceFileName.value;
        var contractPriceFileNameWithPathWithPathEncoded=parent.document.QuotationForm.contractPriceFileNameWithPathWithPathEncoded.value;
        var currentPriceUnitsString =parent.document.QuotationForm.currentPriceUnitsString.value;
        var targetPriceUnitsString=parent.document.QuotationForm.targetPriceUnitsString.value;
        var competatior1PriceUnitsType = parent.document.QuotationForm.competatior1PriceUnitsType.value;
        var competatior1PriceUnitOthers= parent.document.QuotationForm.competatior1PriceUnitOthers.value;
        var competatior2PriceUnitsType = parent.document.QuotationForm.competatior2PriceUnitsType.value;
        var competatior2PriceUnitOthers= parent.document.QuotationForm.competatior2PriceUnitOthers.value;
        var rebateTargetGoalTimeFrame = parent.document.QuotationForm.rebateTargetGoalTimeFrame.value;
        var rebateTargetGoalTimeFrameOthers = parent.document.QuotationForm.rebateTargetGoalTimeFrameOthers.value;
        var competatior1PriceUnitString = parent.document.QuotationForm.competatior1PriceUnitString.value;
        var competatior2PriceUnitString = parent.document.QuotationForm.competatior2PriceUnitString.value;

        var bgcolor = "#DEE1E2"
        var bgcolor1 = "#FFFFEE";
        var tab = document.getElementById("prevQuotation");
        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp; &nbsp;Customer Name :&nbsp;';
        newCell.innerHTML  = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        htmltext = customerName;
        newCell.innerHTML = htmltext;

        var tab = document.getElementById("prevQuotation");
        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>1.</b> Who is the <bean:message key="label.sales.shipToCustomer"/>?';
        newCell.innerHTML  = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (endCustomerId !="-2")
            htmltext = endCustomer;
        else
            htmltext = '&nbsp;';
        newCell.innerHTML = htmltext;

        var tab = document.getElementById("prevQuotation");
        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp; New ' + '<bean:message key="label.sales.shipToCustomer"/>';
        newCell.innerHTML  = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (endCustomerId =="-2")
            htmltext = newEndCustomerName;
        else
            htmltext = '&nbsp;';
        newCell.innerHTML = htmltext;


        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>2.</b> Who is the <bean:message key="label.sales.endUser"/>?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (odmId !="-2")
            htmltext = odm;
        else
            htmltext = '&nbsp;';
        newCell.innerHTML = htmltext;

        var tab = document.getElementById("prevQuotation");
        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp; New ' + '<bean:message key="label.sales.endUser"/>';
        newCell.innerHTML  = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR'
        newCell.align="left";
        if (odmId =="-2")
            htmltext =   newEndUserName;
        else
            htmltext = '&nbsp;';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>3.</b> What type of quote do you need?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext = quotationType ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>4.</b> What is the prev quotation number?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (prevQuotationNo !='null')
        var htmltext =  prevQuotationNo + '&nbsp;&nbsp;' ;
        else
        var htmltext = '&nbsp;' ;
        htmltext=htmltext + '<font class="NArialL"><a href="javascript:loadPrevQuotations()" >Prev Quotations</a></font>';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>5.</b> Pricing';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext= ' &nbsp;&nbsp;<font class="NArialL"><a href="javascript:loadQuotationsPrices()" >Current Price</a></font>';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext =' &nbsp;&nbsp;&nbsp;  <b>a.</b> What is their current price?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        htmltext = '$' + '<input type="text" name="currentPrice" size=8 class="valuetxfield" value="' + currentPrice + '" disabled ="true"/>';
        htmltext= htmltext + ' /Chips@ ';
        htmltext = htmltext +  '<input type="text" name="currentPriceUnitsString" size=8 class="valuetxfield" value="' + targetPriceUnitsString + '" disabled ="true"/> Units';
        htmltext = htmltext +  ' / ';
        if (currentPriceUnitsType != '-1')
        htmltext = htmltext +  '<font color="#993333">' + currentPriceUnitsType + '</font>';
        else
        htmltext = htmltext +  '&nbsp;';
        htmltext = htmltext +  '&nbsp;&nbsp;&nbsp;Others';
        htmltext = htmltext + '&nbsp;&nbsp;&nbsp;';
        htmltext = htmltext + '<input type="text" name="currentPriceOthers" size=8 class="valuetxfield" value="' + currentPriceOthers + '" disabled ="true"/>';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext =' &nbsp;&nbsp;&nbsp; <b>b.</b> What is their target price?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        htmltext = '$' + '<input type="text" name="targetPrice" size=8 class="valuetxfield" value="' + targetPrice + '" disabled ="true"/>';
        htmltext= htmltext + ' /Chips@ ';
        htmltext = htmltext + '<input type="text" name="targetPriceUnitsString" size=8 class="valuetxfield" value="' + targetPriceUnitsString + '" disabled ="true"/> Units';
        htmltext = htmltext + ' / ';
        if (targetPriceUnitsType != '-1')
        htmltext = htmltext + '<font color="#993333">' + targetPriceUnitsType + '</font>';
        else
        htmltext = htmltext + '&nbsp;';
        htmltext = htmltext + '&nbsp;&nbsp;&nbsp;Others';
        htmltext = htmltext + '&nbsp;&nbsp;&nbsp;';
        htmltext = htmltext + '<input type="text" name="targetPriceOthers" size=8 class="valuetxfield" value="' + targetPriceOthers + '" disabled ="true"/>';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext =' &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Any other historical price information';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (historyPricesInfo !='null')
        var htmltext = '<font class="NArialL"><textarea name="historyPricesInfo" class="txfield" rows="3" cols="40"  disabled="true"  >'+ historyPricesInfo +'</textarea></font>';
        else
        var htmltext = '<font class="NArialL"><textarea name="historyPricesInfo" class="txfield" rows="3" cols="40"  disabled="true"  ></textarea></font>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;  <b>c.</b> Is there a contract?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext = '<input type=checkbox name="contractPriceFlag" checked = "'+ contractPriceFlag +'" disabled="true"> Yes';;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Please provide contract pricing document:';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if ( contractPriceFileName != null && contractPriceFileName != '' && contractPriceFileName != 'null' )
        var htmltext = '<font class="NArialL"><a href="'+ contractPriceFileNameWithPathWithPathEncoded + '" target="contractPriceFileWindow" >'+ contractPriceFileName +'</a></font>';
        else
        var htmltext='&nbsp;';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Why does the price need to be changed?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext = '<font class="NArialL"><textarea name="contractPriceChangedReason" class="txfield" rows="3" cols="40"  disabled="true"  >'+ contractPriceChangedReason+'</textarea></font>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp; <b>d.</b> How has the customer performed on their<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  previous commitments?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (previousCommitments != '-1')
            htmltext =  '<b><font color="#993333">' + previousCommitments +'</font></b> &nbsp; Quantities,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ';
        else
            htmltext = ' &nbsp;';
        htmltext = htmltext + ' <font class="NArialL"><a href="javascript:loadPrevCommitments()" >Prev commitments</a></font><br>';
        if (previousCommitments != '-1')
            htmltext = htmltext + '<b><font color="#993333">' +   previousCommitmentsPrice  +'</font></b> &nbsp; Pricing';
        else
            htmltext = htmltext +  '&nbsp;';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Additional info :';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (commitmentAddtionalInfo != 'null')
        var htmltext = '<textarea name="commitmentAddtionalInfo" class="txfield" rows="3" cols="40"  disabled="true"  >'+ commitmentAddtionalInfo+'</textarea>' ;
        else
        var htmltext = '<textarea name="commitmentAddtionalInfo" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;  <b>e.</b> Does this negatively impact <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;any other pricing we have Quoted else where?  ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";

        if (previousQuotation)
        {
            var htmltext = '<input type=checkbox name="previousQuotation" checked = "true" disabled="true"> Yes &nbsp;&nbsp;';
             htmltext =  htmltext  +'<input type=checkbox name="previousQuotation1" disabled="true"> No';
        }
        else
        {
            var htmltext = '<input type=checkbox name="previousQuotation"  disabled="true"> Yes &nbsp;&nbsp;';
            htmltext =  htmltext  +'<input type=checkbox name="previousQuotation1" checked disabled="true"> No';
        }
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Explain   ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
         if (commitmentAddtionalInfo != 'null')
            var htmltext = '<textarea name="previousQuotationDetails" class="txfield" rows="3" cols="40"  disabled="true"  >'+ previousQuotationDetails +'</textarea>' ;
        else
            var htmltext = '<textarea name="previousQuotationDetails" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext = '&nbsp;&nbsp;&nbsp; <b>f.</b> Why should <bean:message key="label.customerName"/> provide <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a price discount?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (priceDiscountReason !='-1')
        htmltext = '&nbsp;' + priceDiscountReason ;
        else
        htmltext = '&nbsp;' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Explain   ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
         if (priceDiscountComments != 'null')
            var htmltext = '<textarea name="priceDiscountComments" class="txfield" rows="3" cols="40"  disabled="true"  >'+ priceDiscountComments +'</textarea>' ;
        else
            var htmltext = '<textarea name="priceDiscountComments" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;  <b>g.</b> Is there a  rebate?  ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";

        if (rebate)
        {
             var htmltext = '<input type=checkbox name="rebate" checked = "true" disabled="true"> Yes &nbsp;&nbsp;';
             htmltext =  htmltext  +'<input type=checkbox name="rebate1" disabled="true"> No';
             htmltext =  htmltext  +' &nbsp; &nbsp; Rebate Value $<input type="text" name="rebateValue" size=6 class="valuetxfield" value="' + rebateValue +'" disabled ="true"/>';
        }
        else
        {
            var htmltext = '<input type=checkbox name="rebate"  disabled="true"> Yes &nbsp;&nbsp;';
            htmltext =  htmltext  +' <input type=checkbox name="rebate1" checked disabled="true"> No';
        }
        newCell.innerHTML = htmltext;
        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Why is there a rebate needed for <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this opportunity? &nbsp;';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
         if (rebateOpertunity != 'null')
            var htmltext = '<textarea name="rebateOpertunity" class="txfield" rows="3" cols="40"  disabled="true"  >'+ rebateOpertunity +'</textarea>' ;
        else
            var htmltext = '<textarea name="rebateOpertunity" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ();
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What is the target rebate goal?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext =  '$<font class="NArialL"><input type="text" name="rebateTargetValue" size=10 class="valuetxfield" value="' + rebateTargetValue + '" disabled ="true"/>';

        if (rebateTarget != '-1')
            htmltext =  htmltext +rebateGoal;
        else
            htmltext =  htmltext +  '&nbsp;';

        if (rebateTargetGoalTimeFrame != -1)
            htmltext =  htmltext + '&nbsp;&nbsp;/<font color="#993333">' + rebateTargetGoalTimeFrame + '</font>';
        else
            htmltext =  htmltext + '&nbsp;&nbsp;&nbsp;&nbsp;';

        if (rebateTargetGoalTimeFrame == 'NA')
        {
            htmltext =  htmltext + '&nbsp; &nbsp; Others &nbsp;' ;
            if (rebateTargetGoalTimeFrameOthers != null )
                htmltext =  htmltext + rebateTargetGoalTimeFrameOthers;
        }
        else
            htmltext =  htmltext + '&nbsp;&nbsp;&nbsp;&nbsp;';
        newCell.innerHTML = htmltext;
        
        var newRow = tab.insertRow ();
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How will the rebate be verified?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (rebateVerifiedBy != 'null')
            var htmltext = '<textarea name="rebateVerifiedBy" class="txfield" rows="3" cols="40"  disabled="true"  >'+ rebateVerifiedBy +'</textarea>' ;
        else
            var htmltext = '<textarea name="rebateVerifiedBy" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>6.</b> Competition ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext = '&nbsp; ' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;<b>a.</b> Who is the first competitor? ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (competatior1 != '-1')
            htmltext =  competatior1;
        else
            htmltext =  '&nbsp;';
        if ( competatior1 =='Other')
            htmltext =htmltext +  competatior1Others;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  What is their price?   ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (competatior1 != '-1')
        {
            htmltext = '$<font class="NArialL"><input type="text" name="competatior1Price" size=10 class="valuetxfield" value="' +  competatior1Price + '" disabled ="true"/>';
            htmltext= htmltext + ' /Chips@ ';
            htmltext = htmltext +  '<input type="text" name="competatior1PriceUnit" size=8 class="valuetxfield" value="' + competatior1PriceUnitString + '" disabled ="true"/> Units';
            htmltext = htmltext +  ' / ';
            if (competatior1PriceUnitsType != 'null')
                htmltext = htmltext +  '<font color="#993333">' + competatior1PriceUnitsType + '</font>';
            else
            htmltext = htmltext +  '&nbsp;';
            if (competatior1PriceUnitsType == 'NA')
            {
                htmltext = htmltext +  '&nbsp;&nbsp;&nbsp;Others';
                htmltext = htmltext + '&nbsp;&nbsp;&nbsp;';
                htmltext = htmltext + '<input type="text" name="competatior1PriceUnitOthers" size=8 class="valuetxfield" value="' + competatior1PriceUnitOthers + '" disabled ="true"/>';
            }
         }
         else
         htmltext =  '&nbsp;';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Comments ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (rebateVerifiedBy != 'null')
            var htmltext = '<textarea name="competatior1Comments" class="txfield" rows="3" cols="40"  disabled="true"  >'+ competatior1Comments +'</textarea>' ;
        else
            var htmltext = '<textarea name="competatior1Comments" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

         var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;<b>b.</b> Who is the second competitor?';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (competatior2 != '-1')
            htmltext =  competatior2;
        else
            htmltext =  '&nbsp;';
        if ( competatior2 =='Other')
        htmltext =htmltext +  competatior2Others;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What is their price?   ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (competatior2 != '-1')
        {
            htmltext = '$<font class="NArialL"><input type="text" name="competatior2Price" size=10 class="valuetxfield" value="' +  competatior2Price + '" disabled ="true"/>';
            htmltext= htmltext + ' /Chips@ ';
            htmltext = htmltext +  '<input type="text" name="competatior2PriceUnit" size=8 class="valuetxfield" value="' + competatior2PriceUnitString + '" disabled ="true"/> Units';
            htmltext = htmltext +  ' / ';
            if (competatior2PriceUnitsType != 'null')
                htmltext = htmltext +  '<font color="#993333">' + competatior2PriceUnitsType + '</font>';
            else
                htmltext = htmltext +  '&nbsp;';
            if (competatior2PriceUnitsType != 'null' && competatior2PriceUnitsType == 'NA')
            {
                htmltext = htmltext +  '&nbsp;&nbsp;&nbsp;Others';
                htmltext = htmltext + '&nbsp;&nbsp;&nbsp;';
                htmltext = htmltext + '<input type="text" name="competatior2PriceUnitOthers" size=8 class="valuetxfield" value="' + competatior2PriceUnitOthers + '" disabled ="true"/>';
            }    
         }
         else
         htmltext =  '&nbsp;';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Comments ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (competatior2Comments != 'null')
            var htmltext = '<textarea name="competatior2Comments" class="txfield" rows="3" cols="40"  disabled="true"  >'+ competatior2Comments +'</textarea>' ;
        else
            var htmltext = '<textarea name="competatior2Comments" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='<b>7.</b> Distributor Margin';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        var htmltext = '&nbsp; ' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp; <b>a.</b>  What is the distributor margin? ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        htmltext =  '&nbsp;&nbsp;<font class="NArialL"><input type="text" name="distributorMargin" size=10 class="valuetxfield" value="' + distributorMargin + '" disabled ="true"/>%';
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp; <b>b.</b> Margin dollars :  <br> &nbsp; &nbsp; &nbsp; &nbsp; [(disti margin %) * (ASP)* (# Of units)]? ';
        newCell.innerHTML = htmltext;
        
        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        htmltext =  '$<font class="NArialL"><input type="text" name="marginDollars" size=10 class="valuetxfield" value="' + marginDollars + '" disabled ="true"/>';
        if (targetPriceUnitsType != '-1' && targetPriceUnitsType != 'NA')
            htmltext = htmltext + '<font color="#993333">' + targetPriceUnitsType + '</font>';
        if (targetPriceUnitsType == 'NA' && targetPriceOthers != null)
            htmltext = htmltext + '<font color="#993333">' + targetPriceOthers + '</font>';

        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ( );
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp; <b>c.</b> What have they done to earn these ';
        htmltext  = htmltext + '<br>&nbsp;  &nbsp; &nbsp;&nbsp;&nbsp; margin dollars? ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (totalPrevMargins != 'null')
            var htmltext = '<textarea name="totalPrevMargins" class="txfield" rows="3" cols="40"  disabled="true"  >'+ totalPrevMargins +'</textarea>' ;
        else
            var htmltext = '<textarea name="totalPrevMargins" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

        var newRow = tab.insertRow ();
        var newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLB';
        var htmltext ='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Why do they need this margin? ';
        newCell.innerHTML = htmltext;

        newCell = newRow.insertCell();
        newCell.bgColor=bgcolor1;
        newCell.className='tdThinBorderLBR';
        newCell.align="left";
        if (marginReason != 'null')
            var htmltext = '<textarea name="marginReason" class="txfield" rows="3" cols="40"  disabled="true"  >'+ marginReason +'</textarea>' ;
        else
            var htmltext = '<textarea name="marginReason" class="txfield" rows="3" cols="40"  disabled="true"  >&nbsp;</textarea>' ;
        newCell.innerHTML = htmltext;

    }
</script>
</HEAD>

<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" onload="addTextArea()">
<form name="quotePopup" method="POST" >
<table width="98%" cellspacing='0' cellpadding='0' border="0" align=center>
    <tr><td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=3></td></tR>
    <tr>
        <td colspan="3" align="center" class="NArialL">
                <h4> Quotation Questionnaire Details  </h4>
        </td>
    </tr>
    <tr><td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=3></td></tR>
    <tr><td colspan=3 align="right"> <a href="javascript:closeWindow(quotePopup);" onMouseOver="window.status='Click here to close this window';return true" onmouseout="window.status='';return true" ><font class='NArialL'>Close</font></a></td></tr>
    <tr>
        <td colspan="3" width="100%">
            <table border="0" width="100%">
                <tr>
                    <td height="100%" width="33%">
                        <table id="prevQuotation" class="bodytext" border=0 width="100%" height="100%" cellspacing='0' cellpadding='2' style="border-width: 1px;">
                            <tr height=20>
                                <td class="tdThinBorderLTB" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">&nbsp;  </font></font></td>
                                <td class="tdThinBorderLRTB" bgcolor="#993333" align="right"><font class="NArialL"><font color="#FFFFFF">&nbsp; </font></font></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
</table>
<!-- till here -->
</form>
</BODY>
</HTML>
<%--<% }catch( Exception e ){e.printStackTrace();} %>--%>
